package demo7;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Component
public class Person {
    private String name;

    public Person(){
        System.out.println("Person的构造函数执行了");
    }
    @Value("张三")
    public void setName(String name) {
        System.out.println("setName执行了");
        this.name = name;
    }
    @PostConstruct
    public void init(){
        System.out.println("init执行了");
    }
    @PreDestroy
    public void preDestroy(){
        System.out.println("preDestroy执行了");
    }
    @Override
    protected void finalize() throws Throwable {
    }
}
